<?php

use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class AddMoneyNotifyToRecordCommon extends Migration
{
    private $table = 'repay_record_commons';
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::table($this->table, function (Blueprint $table) {
            $table->unsignedTinyInteger('money_notify_status')->default(1)->comment('老数据=>老光大的,公共成功后要调用资方的接口,告诉他们一声,1=>初始 2 =>通知中 3 => 通知失败 4 => 通知成功');
            $table->string('money_notify_third_record_id')->default('')->comment('资方的主动还款返回的订单号');
            $table->string('money_notify_trade_no')->default('')->comment('资方的主动还款我们的订单号');
            $table->index('money_notify_status','money_notify_status');
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        if(Schema::hasTable($this->table)){
            Schema::table($this->table, function (Blueprint $table) {
                $table->dropIndex('money_notify_status');
                $table->dropColumn('money_notify_status');
                $table->dropColumn('money_notify_third_record_id');
                $table->dropColumn('money_notify_trade_no');

            });
        }
    }
}
